home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-cat-ftpsec-03.txt < prev    next >
Text File  |  1993-10-12  |  39KB  |  929 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                    Internet Engineering Task Force
  8. Internet-Draft            Common Authentication Technology Working Group
  9. Updates: RFC 959                                              S. J. Lunt
  10. <draft-ietf-cat-ftpsec-03.txt>                                  Bellcore
  11.                                                             October 1993
  12.  
  13.  
  14.                         FTP Security Extensions
  15.  
  16. Status of this Memo
  17.  
  18.    This document is an Internet  Draft.   Internet  Drafts  are  working
  19.    documents  of  the Internet Engineering Task Force (IETF), its Areas,
  20.    and its Working Groups. Note that other groups  may  also  distribute
  21.    working documents as Internet Drafts.
  22.  
  23.    Internet Drafts are draft  documents  valid  for  a  maximum  of  six
  24.    months. Internet  Drafts  may  be  updated, replaced, or obsoleted by
  25.    other documents at any time.  It is not appropriate to  use  Internet
  26.    Drafts as reference material or to cite them other than as a "working
  27.    draft" or "work in progress."
  28.  
  29.    Please check the I-D abstract  listing  contained  in  each  Internet
  30.    Draft  directory  to  learn  the  current status of this or any other
  31.    Internet Draft.  The  filename  for  this  draft  is  draft-ietf-cat-
  32.    ftpsec-03.txt.
  33.  
  34.    Distribution of this memo is unlimited.  Please send comments to  the
  35.    <cat-ietf@mit.edu> mailing list.
  36.  
  37. 1. Description
  38.  
  39.    This document defines extensions to the FTP  specification  RFC  959,
  40.    "FILE  TRANSFER  PROTOCOL (FTP)" (October 1985), which provide strong
  41.    authentication, integrity, and confidentiality on  both  the  control
  42.    and  data  channels  with  the introduction of new optional commands,
  43.    replies, and file transfer encodings.
  44.  
  45.    The  following  new  optional  commands  are   introduced   in   this
  46.    specification:
  47.  
  48.       AUTH (Authentication Type),
  49.       ADAT (Authentication Data),
  50.       MIC (Integrity Protected Command),
  51.       ENC (Privacy Protected Command), and
  52.       PROT (Data Channel Protection Level).
  53.  
  54.  
  55.  
  56.  
  57. Expires: April 30, 1994                                         [Page 1]
  58.  
  59. Internet-Draft          FTP Security Extensions             October 1993
  60.  
  61.  
  62.    A new class of reply types (6yz) is  also  introduced  for  protected
  63.    replies.
  64.  
  65.    None of the above commands are required to be implemented,  but  each
  66.    is dependent on the other (except ENC, which is optional).
  67.  
  68.    Note that this specification is compatible with RFC 959.
  69.  
  70. 2. Motivation
  71.  
  72.    The File Transfer Protocol (FTP) currently defined in RFC 959 and  in
  73.    place  on  the  Internet  uses  usernames  and  passwords  passed  in
  74.    cleartext to authenticate clients to servers (via the USER  and  PASS
  75.    commands).   Except  for  services  such as 'anonymous' FTP archives,
  76.    this represents a security  risk  whereby  passwords  can  be  stolen
  77.    through monitoring of local and wide-area networks.  This either aids
  78.    potential  attackers  through   password   exposure   and/or   limits
  79.    accessibility of files to remote users who can or will not accept the
  80.    inherent security risk.
  81.  
  82.    Aside from the problem of authenticating users in  a  secure  manner,
  83.    there  is  also  the  problem  of  protecting  sensitive  data and/or
  84.    verifying its integrity.  An attacker may be able to access  valuable
  85.    or  sensitive  data merely by monitoring a network, or through active
  86.    means may be able to delete or modify the data being  transferred  so
  87.    as  to  corrupt  its integrity.  An active attacker may also initiate
  88.    spurious file transfers to and from a site of the attacker's  choice,
  89.    and  may invoke other commands on the server.  FTP does not currently
  90.    have  any  provision  for  the  encryption  or  verification  of  the
  91.    authenticity  of  commands,  replies, or transferred data.  Note that
  92.    these security services have value even to anonymous file access.
  93.  
  94.    Current practice for sending files securely is generally either:
  95.  
  96.  
  97.      1.  via FTP of files pre-encrypted under keys  which  are  manually
  98.          distributed,
  99.  
  100.      2.  via electronic mail containing an encoding of a file  encrypted
  101.          under keys which are manually distributed,
  102.  
  103.      3.  via a PEM message, or
  104.  
  105.      4.  via the rcp command enhanced to use Kerberos.
  106.  
  107.  
  108.    None of these means could be considered even a de facto standard, and
  109.    none are truly interactive.  A need exists to securely transfer files
  110.    using FTP in a secure  manner  which  is  supported  within  the  FTP
  111.    protocol in a consistent manner and which takes advantage of existing
  112.  
  113.  
  114.  
  115. Expires: April 30, 1994                                         [Page 2]
  116.  
  117. Internet-Draft          FTP Security Extensions             October 1993
  118.  
  119.  
  120.    security infrastructure and technology.  Extensions are necessary  to
  121.    the FTP specification if these security services are to be introduced
  122.    into the protocol in an interoperable way.
  123.  
  124.    Although the FTP control connection follows the Telnet protocol,  and
  125.    Telnet  has  defined an authentication and encryption option [5], RFC
  126.    1123 [4] explicitly forbids the use of Telnet option negotiation over
  127.    the  control  connection (other than Synch and IP).  Also, the Telnet
  128.    authentication and encryption option does not provide  for  integrity
  129.    protection  only  (without confidentiality), and does not address the
  130.    protection of the data channel.
  131.  
  132. 3. New FTP Commands
  133.  
  134.    The following commands are optional, but  dependent  on  each  other.
  135.    They are extensions to the FTP Access Control Commands.
  136.  
  137.    AUTHENTICATION TYPE (AUTH)
  138.  
  139.       The argument field is a  Telnet  string  identifying  a  supported
  140.       authentication  mechanism.   The  command  represents a request to
  141.       perform  an  authentication  protocol   exchange   based   on   an
  142.       authentication  mechanism  identified by the argument.  Currently,
  143.       only KERBEROS_V4 and GSSAPI are defined.
  144.  
  145.       If the server accepts an authentication type with reply code  334,
  146.       then the client must next initiate an authentication exchange (via
  147.       the ADAT command) based on that authentication type.  The goal  of
  148.       the  authentication  exchange is to strongly authenticate the user
  149.       to the server, and to establish a security context [3] under which
  150.       protection of the control and data channels may be performed.
  151.  
  152.       If the server replies with a 234  code,  then  the  authentication
  153.       type  is  accepted,  and  no  ADAT commands are required.  This is
  154.       useful to indicate to the server that the password to be sent in a
  155.       subsequent  PASS  command  is  to  be interpreted differently than
  156.       normal, as in the case of  smart  cards  or  other  non-disclosing
  157.       password   systems.   Challenge  information  intended  for  human
  158.       interpretation may be contained in the  reply.   Such  information
  159.       may also be conveyed in the text of the reply to the USER command.
  160.  
  161.       If the server rejects a type (reply code 504), or any ADAT command
  162.       fails,  then  the  client  may  try another authentication type by
  163.       issuing another AUTH command, or may continue by sending USER  and
  164.       PASS  commands.   Thus,  the  client should request authentication
  165.       types in decreasing order of  preference  (i.e.,  strength).   The
  166.       server  will  reject  (with  a  503  reply  code) any AUTH or ADAT
  167.       commands  sent  after  an  authentication  protocol   successfully
  168.       completes.
  169.  
  170.  
  171.  
  172.  
  173. Expires: April 30, 1994                                         [Page 3]
  174.  
  175. Internet-Draft          FTP Security Extensions             October 1993
  176.  
  177.  
  178.       The client should not require  the  server  to  support  the  AUTH
  179.       command  or  any  particular  authentication  type.  If either the
  180.       server does not support the AUTH command (reply code 500), or  the
  181.       client  and  server  cannot agree on an authentication type, or no
  182.       authentication exchange succeeds, then the default USER  and  PASS
  183.       commands must be performed.
  184.  
  185.       The AUTH command will normally be the first command transmitted by
  186.       the  user after the control connections are made, generally before
  187.       the USER command.   However,  some  authentication  protocols  may
  188.       require  prior  knowledge  of  the  remote  user  name (e.g., some
  189.       challenge/response systems).  In this case, the USER  command  may
  190.       be sent in advance of the AUTH command.
  191.  
  192.       Some servers will require that authentication be performed  before
  193.       certain commands (including USER) will be accepted.  In this case,
  194.       a 530  reply  will  be  sent  indicating  that  an  authentication
  195.       exchange is required.
  196.  
  197.  
  198.    AUTHENTICATION DATA (ADAT)
  199.  
  200.       The argument field is a  Telnet  string  representing  a  base  64
  201.       encoded  authentication  data (see Section 5, "Base 64 Encoding").
  202.       The data is specific to the authentication protocol specified by a
  203.       previous  AUTH  command.   The  ADAT  command,  and the associated
  204.       replies, allow the client  and  server  to  conduct  an  arbitrary
  205.       authentication protocol.  The client will send authentication data
  206.       to the server via the ADAT  command,  and  the  server  will  send
  207.       authentication  back  to  the client by including "ADAT=string" in
  208.       the reply, where string is also a Telnet string representing  base
  209.       64  encoded authentication data.  The server will reply 501 if the
  210.       string could not be base 64 decoded.
  211.  
  212.       If the server sends a 535  reply,  then  the  authentication  data
  213.       could  not  be successfully processed, and the client has not been
  214.       authenticated.  The client may either try  another  authentication
  215.       type  by  sending  another AUTH command, or may send USER and PASS
  216.       commands.  The server will  reply  503  if  no  AUTH  command  was
  217.       previously accepted.
  218.  
  219.       If the server sends a 335 reply, then the authentication data  was
  220.       successfully  processed, but more authentication data is necessary
  221.       to complete the authentication process.  In this case, the  server
  222.       must include encoded authentication data in the reply.  The client
  223.       must process this  returned  data  and  then  issue  another  ADAT
  224.       command.
  225.  
  226.       If the server sends a  235  reply,  optionally  including  encoded
  227.       authentication   data,   then  the  server  considers  the  client
  228.  
  229.  
  230.  
  231. Expires: April 30, 1994                                         [Page 4]
  232.  
  233. Internet-Draft          FTP Security Extensions             October 1993
  234.  
  235.  
  236.       authenticated.  The client must process  any  authentication  data
  237.       present in the reply.
  238.  
  239.       Appendix I defines the actual protocol for KERBEROS_V4.   Appendix
  240.       II defines the actual protocol for the GSSAPI.
  241.  
  242.       If an authentication exchange succeeds, then the client's identity
  243.       has  been  authenticated  but not yet authorized.  The client must
  244.       next invoke the USER command to identify to the server the account
  245.       (file  system) for which access is requested.  If the USER command
  246.       results in a 231 reply, then the  client  is  authorized,  and  no
  247.       password is required.  However, the client must then send the PASS
  248.       command to actually log  the  user  in  (the  actual  password  is
  249.       ignored and should be a dummy value).  If the USER command results
  250.       in a 333 reply,  then  the  user  was  not  authorized  without  a
  251.       password,  and  a password must be sent with the PASS command.  In
  252.       this case,  it  is  recommended  that  the  PASS  command  be  ENC
  253.       protected.   Additional  USER  or  PASS commands may be sent after
  254.       success of an ADAT command.
  255.  
  256.       Once the client is successfully authenticated via  AUTH  and  ADAT
  257.       commands,  the rest of the data over the control channel (commands
  258.       and replies) must  be  protected,  either  with  integrity  (by  a
  259.       cryptographic   checksum)   via   the   MIC   command,   or   with
  260.       confidentiality (by encryption) via the ENC  command.   (Also  see
  261.       Section  4  on  protected  replies.)  These  two  commands  may be
  262.       arbitrarily intermixed.  It is up to the client to decide which of
  263.       MIC  and  ENC  commands to use, and it is up to the server when to
  264.       accept either.  The server will return a 502 reply  to  any  other
  265.       command.   The  server  will  return  a  500 reply to a MIC or ENC
  266.       command if no ADAT command succeeded.
  267.  
  268.       Commands sent via the  Telnet  out-of-band  signal  must  also  be
  269.       protected.   That  is,  if  the client sends the Telnet "Interrupt
  270.       Process" (IP) signal followed by the Telnet "Synch"  signal,  then
  271.       the  command  sent  to the server immediately afterwards must also
  272.       protected.
  273.  
  274.       A requirement of all specifications for  authentication  exchanges
  275.       based  on  new  authentication  types  is  that they convey to the
  276.       caller whether encryption is supported on the  resultant  security
  277.       context,  since  it is not a requirement that the ENC command, 632
  278.       protected replies, or the Private protection level  be  supported.
  279.       It is also strongly suggested that per message protection services
  280.       supported by each mechanism perform  message  replay  and  out-of-
  281.       sequence  detection,  since  no  provision  for  these services is
  282.       explicitly made within this specification.
  283.  
  284.       Since no explicit provision is made in this specification for  the
  285.       negotiation  of  alternate  mechanisms  for performing per message
  286.  
  287.  
  288.  
  289. Expires: April 30, 1994                                         [Page 5]
  290.  
  291. Internet-Draft          FTP Security Extensions             October 1993
  292.  
  293.  
  294.       protection services, implementors should instead utilize the token
  295.       exchange for this purpose.
  296.  
  297.  
  298.    INTEGRITY PROTECTED COMMAND (MIC)
  299.  
  300.       The argument field is a Telnet string  consisting  of  a  base  64
  301.       encoded  "safe"  message  produced  by an authentication mechanism
  302.       specific message integrity procedure.  The server will decode  the
  303.       received  string,  verify  its  integrity  via  the authentication
  304.       mechanism specific message integrity procedure, and upon  success,
  305.       interpret  the  resultant  string  as  an  FTP command.  The user-
  306.       process need not include the Telnet end-of-line  code  within  the
  307.       encoded command.
  308.  
  309.       The server will return a 501 reply if the argument  could  not  be
  310.       properly base 64 decoded.
  311.  
  312.       The server will return a 535 reply to any MIC command which  fails
  313.       checksum, replay, sequencing, or other applicable security checks.
  314.  
  315.       The server may return a 402 reply to a MIC command if  it  is  not
  316.       willing  to  accept  MIC  commands  and  instead  will  accept ENC
  317.       commands only.  In this case, the client should retry the enclosed
  318.       command under ENC protection.
  319.  
  320.       The three replies defined above must themselves be protected.
  321.  
  322.       There are no other direct replies from MIC or  ENC  commands;  the
  323.       resultant FTP command will generate its own replies.
  324.  
  325.       In environments where the native character set is not  ASCII,  the
  326.       client  must  translate  the  encapsulated command to ASCII before
  327.       passing  it  to  the  protection  routine,  and  the  server  must
  328.       translate  the  encapsulated  command from ASCII after passing the
  329.       token to the protection routine.
  330.  
  331.  
  332.    PRIVACY PROTECTED COMMAND (ENC)
  333.  
  334.       The argument field is a Telnet string  consisting  of  a  base  64
  335.       encoded  "private" message produced by an authentication mechanism
  336.       specific  message  confidentiality  procedure.   The  server  will
  337.       decode   the   received   string,   verify   its   integrity   and
  338.       confidentiality via the authentication mechanism specific  message
  339.       confidentiality   procedure,   and  upon  success,  interpret  the
  340.       resultant string as an FTP command.
  341.  
  342.       It is strongly recommended that PASS commands be  sent  under  ENC
  343.       protection, when possible.
  344.  
  345.  
  346.  
  347. Expires: April 30, 1994                                         [Page 6]
  348.  
  349. Internet-Draft          FTP Security Extensions             October 1993
  350.  
  351.  
  352.       The server will return a 501 reply if the argument  could  not  be
  353.       properly base 64 decoded.
  354.  
  355.       The server will return a 535 reply to any ENC command which cannot
  356.       be  properly  decrypted, or fails checksum, replay, sequencing, or
  357.       other applicable security checks.
  358.  
  359.       The server will return a 402 reply if it does not support the  ENC
  360.       command.   In  this  case,  the  client  should retry the enclosed
  361.       command under MIC protection.
  362.  
  363.       The three replies defined above must themselves be protected.
  364.  
  365.  
  366.    DATA CHANNEL PROTECTION LEVEL (PROT)
  367.  
  368.       The argument is a single Telnet character code specifying the data
  369.       channel  protection  level.  The PROT command will be rejected and
  370.       the server will reply 504 if no previous ADAT  command  succeeded,
  371.       or the specified protection level is not supported.  Upon success,
  372.       a 200 reply will be sent by the server, indicating  that  the  new
  373.       protection level is now in effect.
  374.  
  375.       The following codes are assigned for protection levels:
  376.  
  377.          C - Clear
  378.          S - Safe
  379.          P - Private
  380.  
  381.       The default protection level is Clear.  The Safe protection  level
  382.       is  required  to  be implemented by all authentication types which
  383.       exchange ADAT  commands,  but  the  Private  protection  level  is
  384.       optional.
  385.  
  386.       When using the Safe protection level, all data sent over the  data
  387.       channel  is  to  be integrity protected by cryptographic checksum.
  388.       When using the Private protection level, all data  sent  over  the
  389.       data channel is to be privacy protected by encryption.
  390.  
  391.       The  sender  will  apply  protection  services  after   all   data
  392.       transformations  associated  with the current representation type,
  393.       file structure, and transfer mode have been performed.   The  data
  394.       sent   over  the  data  channel  is,  for  the  purposes  of  data
  395.       protection, to be treated as a  byte  stream.   An  authentication
  396.       mechanism  specific  data protection procedure will be employed by
  397.       the sender to protect this  byte  stream.   The  procedure  should
  398.       process  a  buffer  of  bytes  at a time, and send the result as a
  399.       stream of bytes, prepending each transferred  buffer  with  a  two
  400.       byte  length field (most significant byte first).  Thus, a minimal
  401.       implementation must be able to handle a buffer  length  of  65,536
  402.  
  403.  
  404.  
  405. Expires: April 30, 1994                                         [Page 7]
  406.  
  407. Internet-Draft          FTP Security Extensions             October 1993
  408.  
  409.  
  410.       bytes.   (Implementors  must  ensure  that  they encrypt a maximum
  411.       cleartext  buffer  somewhat  smaller  than  this  such  that   the
  412.       resultant  ciphertext buffer is assured to be no greater than this
  413.       maximum.) The receiver will read the two byte  length  field,  and
  414.       then  read  that  number  of  bytes of protected data, passing the
  415.       buffer to an authentication  mechanism  specific  data  protection
  416.       procedure.   Further  buffers will be similarly read and processed
  417.       until all bytes are sent.  Any transformations associated with the
  418.       current  representation  type,  file  structure, and transfer mode
  419.       would then be performed by the receiver  on  the  resultant  data.
  420.       When  using  block  transfer mode, the sender's (cleartext) buffer
  421.       size is independent of the block size.
  422.  
  423.       Under the Clear protection level (i.e., as  currently  defined  in
  424.       RFC  959),  and  when  in stream mode, the sender indicates end of
  425.       file  by  closing  the  data  connection.   This   is   inherently
  426.       unreliable,  since  the  receiver  cannot  determine  whether  the
  427.       connection was closed prematurely.  Transferring files  under  the
  428.       Safe  or  Private  protection  level allows the sender to convey a
  429.       positive indication of end of file by sending a  protected  buffer
  430.       which contains zero bytes of cleartext data.  Upon receipt of such
  431.       a zero length cleartext buffer, the  recipient  should  close  the
  432.       data  connection (without further reading from the connection) and
  433.       consider the file transfer complete.  If the connection is  closed
  434.       before such a buffer is received, then the file transfer should be
  435.       aborted, and the user should be alerted.  If the  server  was  the
  436.       recipient, then it should send a 535 reply in this case.
  437.  
  438.       If any data protection services  fail  at  any  time  during  data
  439.       transfer at the server end, the server will send a 535 reply.
  440.  
  441.       The server will reply 534 to a STOR, STOU, RETR,  LIST,  NLST,  or
  442.       APPE  command  if the current protection level is not at the level
  443.       dictated by the server's security requirements for the  particular
  444.       file transfer.
  445.  
  446.  
  447. 4. New FTP Replies
  448.  
  449.    All replies after a successful ADAT command must be protected.  A new
  450.    reply type is introduced for this purpose, indicated by a sixth value
  451.    for the first digit of the reply code:
  452.  
  453.    6yz   Protected reply
  454.  
  455.       The text of this reply is to be decoded and interpreted as an  FTP
  456.       reply (if such decoding is successful).  If the reply code is 631,
  457.       then the text of the reply is  integrity  protected  in  the  same
  458.       manner  as  MIC commands.  If the reply code is 632, then the text
  459.       of the reply is privacy  protected  in  the  same  manner  as  ENC
  460.  
  461.  
  462.  
  463. Expires: April 30, 1994                                         [Page 8]
  464.  
  465. Internet-Draft          FTP Security Extensions             October 1993
  466.  
  467.  
  468.       commands.  The server need not include the Telnet end-of-line code
  469.       within the encoded reply.  All replies must be protected  once  an
  470.       ADAT command succeeds.  The server may send a protected reply only
  471.       if a previous ADAT command succeeded.
  472.  
  473.       The security policy of the server will dictate  when  631  or  632
  474.       replies are to be used.  As a general rule, the server should send
  475.       a 631 reply to a MIC command, and a 632 reply to an  ENC  command.
  476.       The  server  must  not  send  632  replies  if the client does not
  477.       support encryption (this  should  be  indicated  by  the  security
  478.       context).  If, upon context establishment, it is not known whether
  479.       the client supports encryption, then the server  may  send  a  632
  480.       reply  only  if  client  support  of encryption has been indicated
  481.       implicitly by means of the client issuing an ENC command or a PROT
  482.       P command.
  483.  
  484.       Multi-line replies are handled as follows.  If the server sends  a
  485.       protected  reply  in  which  the  decoded reply has a hyphen ("-")
  486.       immediately following the reply code, then the  server  will  send
  487.       the  rest  of  the  lines  of  text  of  the multi-line reply each
  488.       protected and base 64 encoded as was  the  first  line,  and  each
  489.       followed  by  the  Telnet  end-of-line code.  The last line of the
  490.       multi-line reply will be that  line  which  when  decoded  by  the
  491.       receiver  begins  with the initial reply code followed by a space.
  492.       For consistency with RFC 959 replies, each  line  of  a  protected
  493.       multi-line  replies  should  begin  with  either a 631 or 632 code
  494.       followed by a hyphen or, on the last line, a space.  However, note
  495.       that  it is the format of the decoded reply, and not the enclosing
  496.       protected reply, that indicates a multi-line reply.
  497.  
  498.       The following is an example showing the  format  of  a  four  line
  499.       multi-line reply:
  500.  
  501.               631-<base64string>
  502.               631-<base64string>
  503.               631-<base64string>
  504.               631 <base64string>
  505.  
  506.       If the server for some reason cannot encode the  reply,  then  the
  507.       unprotected  reply  will  be  sent  instead.   However, the client
  508.       should ignore the reply code of any cleartext reply sent after the
  509.       success of an ADAT command, and instead simply display the text of
  510.       the reply to the user.
  511.  
  512.  
  513. 5. Base 64 Encoding
  514.  
  515.    Base 64 encoding is the same as the Printable Encoding  described  in
  516.    Section 4.3.2.4 of [2] and is defined as follows.
  517.  
  518.  
  519.  
  520.  
  521. Expires: April 30, 1994                                         [Page 9]
  522.  
  523. Internet-Draft          FTP Security Extensions             October 1993
  524.  
  525.  
  526.    Proceeding from left to right, the  bit  string  resulting  from  the
  527.    mechanism  specific  protection  routine  is  encoded into characters
  528.    which  are  universally  representable  at  all  sites,  though   not
  529.    necessarily  with the same bit patterns (e.g., although the character
  530.    "E" is represented in an ASCII-based system as hexadecimal 45 and  as
  531.    hexadecimal  C5  in an EBCDIC-based system, the local significance of
  532.    the two representations is equivalent).
  533.  
  534.    A 64-character subset of International Alphabet IA5 is used, enabling
  535.    6  bits  to  be  represented  per printable character.  (The proposed
  536.    subset of characters is represented identically in  IA5  and  ASCII.)
  537.    The  character  "="  signifies a special processing function used for
  538.    padding within the printable encoding procedure.
  539.  
  540.    The encoding process represents 24-bit groups of input bits as output
  541.    strings  of  4  encoded  characters.   Proceeding  from left to right
  542.    across a 24-bit input group output from the authentication  mechanism
  543.    specific message protection procedure, each 6-bit group is used as an
  544.    index into an array of  64  printable  characters,  namely  "[A-Z][a-
  545.    z][0-9]+/".   The  character referenced by the index is placed in the
  546.    output string.  These characters are selected so as to be universally
  547.    representable,  and  the  set  excludes  characters  with  particular
  548.    significance to Telnet (e.g., "<CR>", "<LF>", IAC).
  549.  
  550.    Special processing is performed if fewer than 24 bits  are  available
  551.    in  an  input group at the end of a message.  A full encoding quantum
  552.    is always completed at the end of a  message.   When  fewer  than  24
  553.    input  bits  are available in an input group, zero bits are added (on
  554.    the right) to form  an  integral  number  of  6-bit  groups.   Output
  555.    character  positions which are not required to represent actual input
  556.    data are set to the character "=".   Since  all  canonically  encoded
  557.    output  is an integral number of octets, only the following cases can
  558.    arise: (1) the  final  quantum  of  encoding  input  is  an  integral
  559.    multiple  of  24 bits; here, the final unit of encoded output will be
  560.    an integral multiple of 4 characters with no  "="  padding,  (2)  the
  561.    final  quantum  of  encoding input is exactly 8 bits; here, the final
  562.    unit of encoded output will be two characters  followed  by  two  "="
  563.    padding  characters,  or  (3)  the final quantum of encoding input is
  564.    exactly 16 bits; here, the final unit of encoded output will be three
  565.    characters followed by one "=" padding character.
  566.  
  567.    Implementors should keep in mind that the base 64 encodings in  ADAT,
  568.    MIC,  and ENC commands, and in 631 and 632 replies may be arbitrarily
  569.    long.  Thus, the entire line must be read before it can be processed.
  570.    Several successive reads on the control channel may be necessary.  It
  571.    is not appropriate to for a server to reject a command  containing  a
  572.    base  64  encoding  simply  because it is too long (assuming that the
  573.    decoding is otherwise well formed in the  context  in  which  it  was
  574.    sent).
  575.  
  576.  
  577.  
  578.  
  579. Expires: April 30, 1994                                        [Page 10]
  580.  
  581. Internet-Draft          FTP Security Extensions             October 1993
  582.  
  583.  
  584.    Case  should  not  be  ignored  when  reading  commands  and  replies
  585.    containing base 64 encodings.
  586.  
  587. 6. Command Summary
  588.  
  589.    The following is a summary of the commands described above:
  590.  
  591.       AUTH <SP> <auth-type> <CRLF>
  592.       ADAT <SP> <base64string> <CRLF>
  593.       MIC  <SP> <base64string> <CRLF>
  594.       ENC  <SP> <base64string> <CRLF>
  595.       PROT <SP> <protection-level> <CRLF>
  596.  
  597.       The syntax of the above argument fields (using BNF notation where
  598.       applicable) is:
  599.  
  600.       <auth-type> ::= <string>
  601.       <string>    ::= <char> | <char><string>
  602.       <char>      ::= any of the 128 ASCII characters except <CR> and <LF>
  603.       <protection-level> ::= C | S | P
  604.       <base64string> ::= <quads> | <quads><terminal>
  605.       <quads> ::= <quad> | <quad><quads>
  606.       <quad> ::= <base64char><base64char><base64char><base64char>
  607.       <base64char> ::= ASCII A through Z
  608.                      | ASCII a through z
  609.                      | ASCII 0 through 9
  610.                      | ASCII +
  611.                      | ASCII /
  612.       <terminal>  ::= <base64char><terminal1><pad><pad>
  613.                     | <base64char><base64char><terminal2><pad>
  614.       <terminal1> ::= A | Q | g | w
  615.       <terminal2> ::= A | E | I | M | Q | U | Y | c |
  616.                       g | k | o | s | w | 0 | 4 | 8
  617.       <pad>       ::= ASCII =
  618.  
  619.  
  620.    The following lists the various reply codes for each new command:
  621.  
  622.    AUTH
  623.       234
  624.       334
  625.       500, 501, 503, 504, 421
  626.    ADAT
  627.       235
  628.       335
  629.       500, 501, 503, 535, 421
  630.    MIC
  631.       402
  632.       500, 501, 535, 421
  633.    ENC
  634.  
  635.  
  636.  
  637. Expires: April 30, 1994                                        [Page 11]
  638.  
  639. Internet-Draft          FTP Security Extensions             October 1993
  640.  
  641.  
  642.       402
  643.       500, 501, 535, 421
  644.    PROT
  645.       200
  646.       500, 501, 504, 421, 530
  647.  
  648.    The following are additional reply codes for existing  commands  (502
  649.    is  the  only  reply for all commands except ENC and MIC once an ADAT
  650.    command succeeds):
  651.  
  652.    USER
  653.       231
  654.       333
  655.    STOR
  656.       534, 535
  657.    STOU
  658.       534, 535
  659.    RETR
  660.       534, 535
  661.    LIST
  662.       534, 535
  663.    NLST
  664.       534, 535
  665.    APPE
  666.       534, 535
  667.  
  668.    The following is the syntax for protected replies:
  669.  
  670.    <code> <SP> <base64string> <CRLF>
  671.    <code> ::= 631 | 632
  672.  
  673.    Lines of the following form may precede this in the case of a  multi-
  674.    line protected reply:
  675.  
  676.    <code> <hyphen> <base64string> <CRLF>
  677.    <hyphen> ::= ASCII -
  678.  
  679. 7. References
  680.  
  681.   [1] Reynolds, Joyce, and Postel, Jon, "File Transfer Protocol  (FTP)",
  682.       RFC 959, ISI, October 1985.
  683.  
  684.   [2] Linn, John, "Privacy Enhancement  for  Internet  Electronic  Mail:
  685.       Part  I:  Message  Encryption  and Authentication Procedures", RFC
  686.       1421, February 1993.
  687.  
  688.   [3] Linn, John, "Generic  Security  Service  API  (GSSAPI)",  Internet
  689.       Draft, November 1992.
  690.  
  691.   [4] Braden, R., "Requirements for Internet Hosts  --  Application  and
  692.  
  693.  
  694.  
  695. Expires: April 30, 1994                                        [Page 12]
  696.  
  697. Internet-Draft          FTP Security Extensions             October 1993
  698.  
  699.  
  700.       Support", RFC 1123, October 1989.
  701.  
  702.   [5]  Borman,  D.,  "Telnet  Authentication  and  Encryption   Option",
  703.       Internet Draft, Cray Research, Inc, April 1993.
  704.  
  705. Security Considerations
  706.  
  707.    Third party file transfers cannot be secured using these  extensions,
  708.    since  a  security  context cannot be established between two servers
  709.    using these facilities (no control connection exists between  servers
  710.    over  which  to  pass  ADAT  tokens).   Further  work in this area is
  711.    deferred.
  712.  
  713. APPENDIX I:  SPECIFICATION UNDER KERBEROS VERSION 4
  714.  
  715.    The authentication  type  (for  the  AUTH  command)  associated  with
  716.    Kerberos   Version   4   is  KERBEROS_V4.   If  the  server  supports
  717.    KERBEROS_V4, it will respond with a 334 reply code indicating that an
  718.    ADAT command is expected next.
  719.  
  720.    The client should  retrieve  a  ticket  for  the  Kerberos  principal
  721.    "ftp.hostname@realm"  by  calling krb_mk_req(3) with a principal name
  722.    of "ftp", an instance equal to the canonical host name of the  server
  723.    with all letters in lower case (as returned by krb_get_phost(3)), the
  724.    server's realm name  (as  returned  by  krb_realmofhost(3)),  and  an
  725.    arbitrary checksum.  The ticket must then be base 64 encoded and sent
  726.    as the argument to an ADAT command.
  727.  
  728.    If the "ftp" principal name is not  a  registered  principal  in  the
  729.    Kerberos  database,  then  the  client  may  fall  back on the "rcmd"
  730.    principal name (same instance  and  realm).   However,  servers  must
  731.    accept  only  one or the other of these principal names, and must not
  732.    be willing to accept either.  Generally, if the server has a key  for
  733.    the "ftp" principal in its srvtab, then that principal only should be
  734.    used, otherwise the "rcmd" principal only should be used.
  735.  
  736.    The server must base 64 decode the argument to the ADAT  command  and
  737.    pass  the  result  to  krb_rd_req(3).  The server must add one to the
  738.    checksum from the authenticator and  sign  it  using  krb_mk_safe(3),
  739.    then  base 64 encode the result.  Upon success, the server must reply
  740.    to the client with a 235 code and include "ADAT=base64string" in  the
  741.    text of the reply.  Upon failure, the server will reply 535.
  742.  
  743.    Upon receipt of the 235 reply from the server, the client must  parse
  744.    the  text  of  the reply for the base 64 encoded data, decode it, and
  745.    pass the result to krb_rd_safe(3).  The client  should  consider  the
  746.    server  authenticated  if the resultant checksum is equal to one plus
  747.    the value previously sent.
  748.  
  749.    The procedure  associated  with  integrity  protected  MIC  commands,
  750.  
  751.  
  752.  
  753. Expires: April 30, 1994                                        [Page 13]
  754.  
  755. Internet-Draft          FTP Security Extensions             October 1993
  756.  
  757.  
  758.    replies, and Safe file transfers is:
  759.  
  760.       krb_mk_safe(3) for the sender
  761.       krb_rd_safe(3) for the receiver
  762.  
  763.    The  procedure  associated  with  privacy  protected  ENC   commands,
  764.    replies, and Private file transfers is:
  765.  
  766.       krb_mk_priv(3) for the sender
  767.       krb_rd_priv(3) for the receiver
  768.  
  769.    Note that this specification for KERBEROS_V4  contains  no  provision
  770.    for  negotiating  alternate  means  for integrity and confidentiality
  771.    routines.  Note also that the ADAT exchange does not  convey  whether
  772.    the peer supports confidentiality services.
  773.  
  774. APPENDIX II: SPECIFICATION UNDER THE GSSAPI
  775.  
  776.    The authentication type (for the AUTH command)  associated  with  all
  777.    mechanisms employing the GSSAPI is GSSAPI.  If the server supports an
  778.    authentication mechanism employing the GSSAPI, it will respond with a
  779.    334 reply code indicating that an ADAT command is expected next.
  780.  
  781.    The client  should  begin  the  authentication  exchange  by  calling
  782.    GSS_Init_Sec_Context, passing in NULL for claimant_cred_handle to get
  783.    the default credentials for the user (this is to  avoid  dependencies
  784.    on  names  for  particular  mechanisms),  0  for input_context_handle
  785.    (initially), NULL for mech_type (indicating  "use  default  mechanism
  786.    type"),  and  a  targ_name  equal to output_name from GSS_Import_Name
  787.    called  with  input_name_type  of  NULL  and   input_name_string   of
  788.    "SERVICE:ftp@hostname"  where  "hostname" is the fully qualified host
  789.    name of the server with all letters in lower case.  The  output_token
  790.    must  then  be base 64 encoded and sent to the server as the argument
  791.    to   an    ADAT    command.     If    GSS_Init_Sec_Context    returns
  792.    GSS_CONTINUE_NEEDED,  then  the  client  should  expect a token to be
  793.    returned in the  reply  to  the  ADAT  command.   This  token  should
  794.    subsequently  be  passed to another call to GSS_Init_Sec_Context.  In
  795.    this case, if GSS_Init_Sec_Context returns no output_token, then  the
  796.    reply  code from the server for the previous ADAT command should have
  797.    been 235.  If  GSS_Init_Sec_Context  returns  GSS_COMPLETE,  then  no
  798.    further  tokens  should  be  expected from the server, and the client
  799.    should consider the server authenticated.
  800.  
  801.    The server must base 64 decode the argument to the ADAT  command  and
  802.    pass  the  resultant  token to GSS_Accept_Sec_Context as input_token,
  803.    setting acceptor_cred_handle to NULL (for "use default credentials"),
  804.    and  0  for  input_context_handle (initially).  If an output_token is
  805.    returned, it should be base 64 encoded and returned to the client  by
  806.    including   "ADAT=base64string"   in  the  text  of  the  reply.   If
  807.    GSS_Accept_Sec_Context returns GSS_COMPLETE, the reply code should be
  808.  
  809.  
  810.  
  811. Expires: April 30, 1994                                        [Page 14]
  812.  
  813. Internet-Draft          FTP Security Extensions             October 1993
  814.  
  815.  
  816.    235,  and  the  server  should consider the client authenticated.  If
  817.    GSS_Accept_Sec_Context returns GSS_CONTINUE_NEEDED,  the  reply  code
  818.    should be 335.  Otherwise, the reply code should be 535, and the text
  819.    of the reply should contain a descriptive error message.
  820.  
  821.    The procedure  associated  with  integrity  protected  MIC  commands,
  822.    replies, and Safe file transfers is:
  823.  
  824.       GSS_Seal for the sender, with conf_flag == FALSE
  825.       GSS_Unseal for the receiver
  826.  
  827.    The  procedure  associated  with  privacy  protected  ENC   commands,
  828.    replies, and Private file transfers is:
  829.  
  830.       GSS_Seal for the sender, with conf_flag == TRUE
  831.       GSS_Unseal for the receiver
  832.  
  833.    Both the client and server should inspect the value of conf_avail  to
  834.    determine whether the peer supports confidentiality services.
  835.  
  836. Author's Address:
  837.  
  838.    Steven J. Lunt
  839.    Bellcore
  840.    RRC-1L213
  841.    444 Hoes Lane
  842.    Piscataway, NJ 08854
  843.  
  844.    Phone: (908) 699-4244
  845.    EMail: lunt@bellcore.com
  846.  
  847.    Mailing List: cat-ietf@mit.edu
  848.  
  849. Chair's Address:
  850.  
  851.    The working group can be contacted via the current chair:
  852.  
  853.    Sam Sjogren
  854.    TGV, Inc.
  855.    603 Mission St.
  856.    Santa Cruz, CA  95060
  857.  
  858.    Phone: (408) 427-4366
  859.    EMail: sjogren@tgv.com
  860.  
  861. Author's Notes:
  862.  
  863.    This is implemented and working for Kerberos V4 on SunOS 4.1.2  using
  864.    SunOS  source  for ftp and ftpd, and also the BSD Reno source for ftp
  865.    and ftpd.
  866.  
  867.  
  868.  
  869. Expires: April 30, 1994                                        [Page 15]
  870.  
  871. Internet-Draft          FTP Security Extensions             October 1993
  872.  
  873.  
  874.    YET TO BE DONE:
  875.  
  876.  
  877.      1.  Implementation using the GSSAPI.
  878.  
  879.      2.  The client may fail when processing the ADAT data  from  a  235
  880.          reply,  in  which case the server thinks things are OK, but the
  881.          client thinks otherwise.  Unclear how to proceed at that point,
  882.          other than to drop the connection.
  883.  
  884.      3.  New state diagrams might need to be drawn  for  how  the  AUTH,
  885.          ADAT, USER, and PASS commands now flow.
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927. Expires: April 30, 1994                                        [Page 16]
  928.  
  929.